<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const arr = [10, 20, 13, 23, 8, 19];
      console.log("原数组", arr);
      arr.sort(function (a, b) {
        return a > b ? 1 : -1;
        // if (a > b) {
        //   return -1;
        // } else {
        //   return 1;
        // }
      });
      console.log("原数组", arr);
    </script>
  </body>
</html>
